

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/fluid.png">
  <link rel="icon" href="/img/fluid.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="John Doe">
  <meta name="keywords" content="">
  
    <meta name="description" content="@[toc] Docker-ce入门级安装与配置 测试环境 Ubuntu 20.04   1. 安装前准备工作 1.1 修改镜像源     1.2 安装CA证书对docker内部的https网络协议的支持 1sudo apt-get install apt-transport-https ca-certificates software-properties-common curl   若出现报错">
<meta property="og:type" content="article">
<meta property="og:title" content="Docker _ 基于Ubuntu20.04系统 _ Docker-ce的入门级安装与基本操作">
<meta property="og:url" content="http://example.com/2021/10/11/Docker%20_%20%E5%9F%BA%E4%BA%8EUbuntu20.04%E7%B3%BB%E7%BB%9F%20_%20Docker-ce%E7%9A%84%E5%85%A5%E9%97%A8%E7%BA%A7%E5%AE%89%E8%A3%85%E4%B8%8E%E5%9F%BA%E6%9C%AC%E6%93%8D%E4%BD%9C/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="@[toc] Docker-ce入门级安装与配置 测试环境 Ubuntu 20.04   1. 安装前准备工作 1.1 修改镜像源     1.2 安装CA证书对docker内部的https网络协议的支持 1sudo apt-get install apt-transport-https ca-certificates software-properties-common curl   若出现报错">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20ce6cd18b6e497b80476083bb1188c7.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_20,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/206c0b833904461d8fe8b5c700fd3643.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/bfeb19985f5a4ccaac123e93c9768096.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_19,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/bb8d872018eb4a4fbf2a8682a21c748a.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/b858ccca6d5b4d8fadfe92fd8ac763e9.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_20,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/4d16ab50e52d4e0baec30689fbde2d11.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_19,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/ae5865ea269843daa1764513948c927a.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/278b1cd8dacc47faad8c6f46dd9f7e54.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_20,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/57726b9685e54e229d13e5bc4e8ee8b6.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/7d1dcb5366c441468bacb9fbbee2c843.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/051edb5531e24cb59a72728d60345272.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/5a4475c0477e4be7a4ca67f8e00e0783.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/97dffc0be7d94c6587a52c747f825cbb.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/ac99992203d146bb9ddb3eaf1e1d7d87.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/0d23d3f031fa4f59993f77047d3babc5.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/88f109226801421da99cb4b37a6a31c5.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/6eb101cb3fa640f584ed43aac91f5521.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/4ad7b79e720f4c7282ca556d8757bc6f.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_18,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/7628b93e93bf4c7780e98222880b9f18.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/6eefa05a93ea406b8f6ffffddea5c32b.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/281aa4c9185f4f36beb8369121e0adb8.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/e3b675d48bcf4611b0ebf229c2ec0135.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/c11e5d8b63c44bcfade46944c81bd0e4.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/4f83e1b0cd714861bed447a4a3ee50ae.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/8fbe82e8f2aa4942a5e4f21b97f0cffb.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_20,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/bc53d13aa9064dd18d962e4de24c7fdf.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_19,color_FFFFFF,t_70,g_se,x_16">
<meta property="og:image" content="https://img-blog.csdnimg.cn/5bb9098813844fbfb87d94fd18a8cb36.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/1097ed845ea24067a42c8461f5b8bf13.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/bf55990c64be4a7684b39dabd0c30811.png">
<meta property="article:published_time" content="2021-10-11T12:35:32.000Z">
<meta property="article:modified_time" content="2022-08-22T15:42:55.794Z">
<meta property="article:author" content="John Doe">
<meta property="article:tag" content="Docker">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://img-blog.csdnimg.cn/20ce6cd18b6e497b80476083bb1188c7.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_20,color_FFFFFF,t_70,g_se,x_16">
  
  
  
  <title>Docker _ 基于Ubuntu20.04系统 _ Docker-ce的入门级安装与基本操作 - Hexo</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"example.com","root":"/","version":"1.9.2","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"follow_dnt":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
  


  
<meta name="generator" content="Hexo 6.2.0"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>尤 Ni&#39;s Blog</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/img/default.png') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="Docker _ 基于Ubuntu20.04系统 _ Docker-ce的入门级安装与基本操作"></span>
          
        </div>

        
          
  <div class="mt-3">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-author" aria-hidden="true"></i>
        John Doe
      </span>
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2021-10-11 20:35" pubdate>
          2021年10月11日 晚上
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          2.7k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          23 分钟
        
      </span>
    

    
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">Docker _ 基于Ubuntu20.04系统 _ Docker-ce的入门级安装与基本操作</h1>
            
              <p class="note note-info">
                
                  
                    本文最后更新于：1 小时前
                  
                
              </p>
            
            
              <div class="markdown-body">
                
                <p>@[toc]</p>
<h1 id="Docker-ce入门级安装与配置"><a href="#Docker-ce入门级安装与配置" class="headerlink" title="Docker-ce入门级安装与配置"></a>Docker-ce入门级安装与配置</h1><blockquote>
<p>测试环境</p>
<p>Ubuntu 20.04 </p>
</blockquote>
<h1 id="1-安装前准备工作"><a href="#1-安装前准备工作" class="headerlink" title="1. 安装前准备工作"></a>1. 安装前准备工作</h1><hr>
<h2 id="1-1-修改镜像源"><a href="#1-1-修改镜像源" class="headerlink" title="1.1 修改镜像源"></a>1.1 修改镜像源</h2><p><img src="https://img-blog.csdnimg.cn/20ce6cd18b6e497b80476083bb1188c7.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_20,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload></p>
<p><img src="https://img-blog.csdnimg.cn/206c0b833904461d8fe8b5c700fd3643.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p><img src="https://img-blog.csdnimg.cn/bfeb19985f5a4ccaac123e93c9768096.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_19,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-5gUb7eJx-1633955078278)(C:/Users/Lenovo/Desktop/2021-10/Docker%E5%AE%89%E8%A3%85%EF%BC%88Ubuntu%EF%BC%89.assets/image-20211010152035478.png)]"><br><img src="https://img-blog.csdnimg.cn/bb8d872018eb4a4fbf2a8682a21c748a.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-SmUxE0Q8-1633955078281)(C:/Users/Lenovo/Desktop/2021-10/Docker%E5%AE%89%E8%A3%85%EF%BC%88Ubuntu%EF%BC%89.assets/image-20211010152657813.png)]"><br><img src="https://img-blog.csdnimg.cn/b858ccca6d5b4d8fadfe92fd8ac763e9.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_20,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p><img src="https://img-blog.csdnimg.cn/4d16ab50e52d4e0baec30689fbde2d11.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_19,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p><img src="https://img-blog.csdnimg.cn/ae5865ea269843daa1764513948c927a.png" srcset="/img/loading.gif" lazyload alt="[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-rh4k94Vz-1633955078285)(C:/Users/Lenovo/Desktop/2021-10/Docker%E5%AE%89%E8%A3%85%EF%BC%88Ubuntu%EF%BC%89.assets/image-20211010152908799.png)]"></p>
<h2 id="1-2-安装CA证书"><a href="#1-2-安装CA证书" class="headerlink" title="1.2 安装CA证书"></a>1.2 安装CA证书</h2><p>对docker内部的https网络协议的支持</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo apt-get install apt-transport-https ca-certificates software-properties-common curl<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/278b1cd8dacc47faad8c6f46dd9f7e54.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_20,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<blockquote>
<p>若出现报错请尝试一下两行命令，未出现则跳过下面这两行</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo apt-get install libcurl3-gnutls=7.47.0-1ubuntu2<br>sudo apt-get update &amp;&amp; sudo apt-get install curl<br></code></pre></td></tr></table></figure>

<h2 id="1-3-添加-GPG-密钥"><a href="#1-3-添加-GPG-密钥" class="headerlink" title="1.3 添加 GPG 密钥"></a>1.3 添加 GPG 密钥</h2><p>添加docker-ce 软件源到Ubuntu系统中</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -<br></code></pre></td></tr></table></figure>

<p><img src="https://img-blog.csdnimg.cn/57726b9685e54e229d13e5bc4e8ee8b6.png" srcset="/img/loading.gif" lazyload alt="[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-cdbZmJ8H-1633955078289)(Docker%E5%AE%89%E8%A3%85%EF%BC%88Ubuntu%EF%BC%89.assets/image-20211010154025974.png)]"></p>
<h2 id="1-4-添加仓库"><a href="#1-4-添加仓库" class="headerlink" title="1.4 添加仓库"></a>1.4 添加仓库</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo add-apt-repository \<br>&quot;deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \<br><span class="hljs-meta prompt_">$</span><span class="language-bash">(lsb_release -cs) \</span><br><span class="language-bash">stable<span class="hljs-string">&quot;</span></span><br></code></pre></td></tr></table></figure>

<p><img src="https://img-blog.csdnimg.cn/7d1dcb5366c441468bacb9fbbee2c843.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-y7fTDgQl-1633955078290)(Docker%E5%AE%89%E8%A3%85%EF%BC%88Ubuntu%EF%BC%89.assets/image-20211010154102556.png)]"></p>
<p><img src="https://img-blog.csdnimg.cn/051edb5531e24cb59a72728d60345272.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-9BtIb3DV-1633955078291)(Docker%E5%AE%89%E8%A3%85%EF%BC%88Ubuntu%EF%BC%89.assets/image-20211010154114100.png)]"></p>
<h2 id="1-5-更新APT"><a href="#1-5-更新APT" class="headerlink" title="1.5 更新APT"></a>1.5 更新APT</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo apt-get update<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/5a4475c0477e4be7a4ca67f8e00e0783.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-dBEhusYB-1633955078292)(Docker%E5%AE%89%E8%A3%85%EF%BC%88Ubuntu%EF%BC%89.assets/image-20211010154147873.png)]"></p>
<h1 id="2-Docker-ce-安装与入门"><a href="#2-Docker-ce-安装与入门" class="headerlink" title="2. Docker-ce 安装与入门"></a>2. Docker-ce 安装与入门</h1><hr>
<h2 id="2-1-安装Docker"><a href="#2-1-安装Docker" class="headerlink" title="2.1 安装Docker"></a>2.1 安装Docker</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo apt-get install docker-ce <br></code></pre></td></tr></table></figure>

<p><img src="https://img-blog.csdnimg.cn/97dffc0be7d94c6587a52c747f825cbb.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-KNjj5Epg-1633955078293)(Docker%E5%AE%89%E8%A3%85%EF%BC%88Ubuntu%EF%BC%89.assets/image-20211010154204333.png)]"></p>
<p><img src="https://img-blog.csdnimg.cn/ac99992203d146bb9ddb3eaf1e1d7d87.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-OwFffiZ6-1633955078294)(Docker%E5%AE%89%E8%A3%85%EF%BC%88Ubuntu%EF%BC%89.assets/image-20211010154220924.png)]"></p>
<p><img src="https://img-blog.csdnimg.cn/0d23d3f031fa4f59993f77047d3babc5.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-hZr8kPfr-1633955078295)(C:/Users/Lenovo/Desktop/2021-10/Docker%E5%AE%89%E8%A3%85%EF%BC%88Ubuntu%EF%BC%89.assets/image-20211010154315803.png)]"></p>
<h2 id="2-2-启动Docker"><a href="#2-2-启动Docker" class="headerlink" title="2.2 启动Docker"></a>2.2 启动Docker</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo service docker start <br></code></pre></td></tr></table></figure>

<blockquote>
<p>输入命令后无报错则成功</p>
</blockquote>
<h2 id="2-3-测试Docker"><a href="#2-3-测试Docker" class="headerlink" title="2.3 测试Docker"></a>2.3 测试Docker</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo docker run hello-world<br></code></pre></td></tr></table></figure>

<p><img src="https://img-blog.csdnimg.cn/88f109226801421da99cb4b37a6a31c5.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_17,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4N74Sq39-1633955078296)(C:/Users/Lenovo/Desktop/2021-10/Docker%E5%AE%89%E8%A3%85%EF%BC%88Ubuntu%EF%BC%89.assets/image-20211010154435990.png)]"></p>
<h2 id="2-4-添加用户到docker用户组"><a href="#2-4-添加用户到docker用户组" class="headerlink" title="2.4 添加用户到docker用户组"></a>2.4 添加用户到docker用户组</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo gpasswd -a $&#123;USER&#125; docker<br></code></pre></td></tr></table></figure>

<p><img src="https://img-blog.csdnimg.cn/6eb101cb3fa640f584ed43aac91f5521.png" srcset="/img/loading.gif" lazyload alt="[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Q0Lgj5uR-1633955078297)(C:/Users/Lenovo/Desktop/2021-10/Docker%E5%AE%89%E8%A3%85%EF%BC%88Ubuntu%EF%BC%89.assets/image-20211010154541692.png)]"></p>
<h2 id="2-5-Docker添加镜像"><a href="#2-5-Docker添加镜像" class="headerlink" title="2.5 Docker添加镜像"></a>2.5 Docker添加镜像</h2><blockquote>
<p>添加纯净的Ubuntu镜像</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo docker pull ubuntu <br><span class="hljs-meta prompt_"># </span><span class="language-bash">查看镜像</span><br>sudo docker images<br></code></pre></td></tr></table></figure>

<p><img src="https://img-blog.csdnimg.cn/4ad7b79e720f4c7282ca556d8757bc6f.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_18,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell"><br></code></pre></td></tr></table></figure>



<h1 id="3-Docker-ce-入门"><a href="#3-Docker-ce-入门" class="headerlink" title="3. Docker-ce 入门"></a>3. Docker-ce 入门</h1><hr>
<h2 id="3-1-docker-run-创建容器"><a href="#3-1-docker-run-创建容器" class="headerlink" title="3.1 docker run 创建容器"></a>3.1 docker run 创建容器</h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs shell">cd /usr/local<br>sudo mkdir dockerbuild<br><br>sudo docker run -it -v /usr/local/dockerbuild:/root/build/ --name pc1 ubuntu<br></code></pre></td></tr></table></figure>

<p><img src="https://img-blog.csdnimg.cn/7628b93e93bf4c7780e98222880b9f18.png" srcset="/img/loading.gif" lazyload alt="[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-nvDZVuNC-1633955078300)(C:/Users/Lenovo/Desktop/2021-10/Docker%E5%AE%89%E8%A3%85%EF%BC%88Ubuntu%EF%BC%89.assets/image-20211010175156893.png)]"></p>
<blockquote>
<p>如上图所示，已经进入了刚创建的容器内部，该容器没有图形化界面，不过可以在终端里进行一系列操作，比如搭建集群</p>
</blockquote>
<blockquote>
<p>root@d6e5d1720bdd 其中@后的内容 <code>d65e5d1720bdd</code> 为容器的ID</p>
</blockquote>
<p>关于 <code>docker run [Options] image [Command] [arg...] </code>命令的参数说明</p>
<p>参考资料：<a target="_blank" rel="noopener" href="https://www.runoob.com/docker/docker-run-command.html">https://www.runoob.com/docker/docker-run-command.html</a></p>
<table>
<thead>
<tr>
<th>参数</th>
<th>说明</th>
</tr>
</thead>
<tbody><tr>
<td>-a stdin</td>
<td>指定标准输入输出内容的类型，可选stdin，stdout，stderr</td>
</tr>
<tr>
<td>-d</td>
<td>后台运行容器，并返回容器的ID</td>
</tr>
<tr>
<td>-i</td>
<td>以交互模式运行，通常与-t同时使用</td>
</tr>
<tr>
<td>-P</td>
<td>随机端口映射，容器内部端口随机映射到主机的端口</td>
</tr>
<tr>
<td>-p</td>
<td>指定端口映射，格式为：&#96;主机（宿主）端口：容器端口</td>
</tr>
<tr>
<td>-t</td>
<td>为容器重新分配一个伪输入终端，通常与-i同时使用</td>
</tr>
<tr>
<td>–name&#x3D;”xxx”</td>
<td>为容器指定一个名称</td>
</tr>
<tr>
<td>–dns 8.8.8.8</td>
<td>指定容器使用的DNS服务器，默认和宿主一致</td>
</tr>
<tr>
<td>–dns-search example.com</td>
<td>指定容器DNS搜索域名，默认和宿主一致</td>
</tr>
<tr>
<td>-h “mars”</td>
<td>指定容器的hostname</td>
</tr>
<tr>
<td>-e username &#x3D; “ritchie”</td>
<td>设置环境变量</td>
</tr>
<tr>
<td>-env-file&#x3D;[]</td>
<td>从指定文件读入环境变量</td>
</tr>
<tr>
<td>–cpuset&#x3D;”0-2” or –cpuset&#x3D;”0,1,2”</td>
<td>绑定容器到指定CPU运行</td>
</tr>
<tr>
<td>-m</td>
<td>设置容器使用内存的最大值</td>
</tr>
<tr>
<td>-net&#x3D;”bridge”</td>
<td>指定容器的网络连接类型，支持bridge&#x2F;host&#x2F;none&#x2F;container四种类型</td>
</tr>
<tr>
<td>–link&#x3D;[]</td>
<td>添加链接到另一个容器</td>
</tr>
<tr>
<td>–expose&#x3D;[]</td>
<td>开放一个端口或一组端口</td>
</tr>
<tr>
<td>–volume, -v</td>
<td>绑定一个卷</td>
</tr>
</tbody></table>
<h2 id="3-2-docker常用命令"><a href="#3-2-docker常用命令" class="headerlink" title="3.2 docker常用命令"></a>3.2 docker常用命令</h2><p>注：以下命令需要区分是在容器内部还是外部</p>
<p>参考资料：<a target="_blank" rel="noopener" href="https://www.runoob.com/docker/docker-command-manual.html">https://www.runoob.com/docker/docker-command-manual.html</a></p>
<h3 id="3-2-1-查看镜像-x2F-容器"><a href="#3-2-1-查看镜像-x2F-容器" class="headerlink" title="3.2.1 查看镜像 &#x2F; 容器"></a>3.2.1 查看镜像 &#x2F; 容器</h3><blockquote>
<p>查看所有镜像</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo docker images<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/6eefa05a93ea406b8f6ffffddea5c32b.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<blockquote>
<p>查看正在运行的容器</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo docker ps<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/281aa4c9185f4f36beb8369121e0adb8.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<blockquote>
<p>查看所有的容器</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo docker ps -a<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/e3b675d48bcf4611b0ebf229c2ec0135.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<h3 id="3-2-2-容器退出-x2F-停止-x2F-重启-x2F-进入"><a href="#3-2-2-容器退出-x2F-停止-x2F-重启-x2F-进入" class="headerlink" title="3.2.2 容器退出 &#x2F; 停止&#x2F; 重启 &#x2F; 进入"></a>3.2.2 容器退出 &#x2F; 停止&#x2F; 重启 &#x2F; 进入</h3><blockquote>
<p>退出容器</p>
</blockquote>
<p><img src="https://img-blog.csdnimg.cn/c11e5d8b63c44bcfade46944c81bd0e4.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<blockquote>
<p>重启容器 （成功后会显示一次容器ID）</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs shell"><span class="hljs-meta prompt_"># </span><span class="language-bash">先查询之前容器的ID</span><br>sudo docker ps -a <br>sudo docker restart d6e5d1720bdd<br></code></pre></td></tr></table></figure>

<p><img src="https://img-blog.csdnimg.cn/4f83e1b0cd714861bed447a4a3ee50ae.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<blockquote>
<p>进入容器 （进入前确保容器已经启动）</p>
</blockquote>
<ul>
<li>docker attach 若再次退出终端，容器自动停止</li>
<li>docker exec  若再次退出终端，容器仍在后台执行 （通常与-it同时使用，表示以交互模式运行并启动伪终端）</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo docker exec -it d6e5d1720bdd /bin/bash<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/8fbe82e8f2aa4942a5e4f21b97f0cffb.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_20,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p>通过上图可知，exec启动的容器，就算在内部用exit命令退出，它仍能在后台运行。</p>
<blockquote>
<p>停止容器</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo docker stop d6e5d1720bdd<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/bc53d13aa9064dd18d962e4de24c7fdf.png?x-oss-process=image/watermark,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBAVW5p5aSn54uX5a2Q,size_19,color_FFFFFF,t_70,g_se,x_16" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p><strong>注：以上命令的容器ID均可用容器的name代替，如下图所示</strong></p>
<p><img src="https://img-blog.csdnimg.cn/5bb9098813844fbfb87d94fd18a8cb36.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<h3 id="3-2-3-删除镜像-x2F-容器"><a href="#3-2-3-删除镜像-x2F-容器" class="headerlink" title="3.2.3 删除镜像 &#x2F; 容器"></a>3.2.3 删除镜像 &#x2F; 容器</h3><blockquote>
<p>删除镜像</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">docker rii 镜像id<br></code></pre></td></tr></table></figure>

<blockquote>
<p>删除容器</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">docker rm 容器id<br></code></pre></td></tr></table></figure>

<p>删除容器前需关闭容器，否则会出现如下的报错<br><img src="https://img-blog.csdnimg.cn/1097ed845ea24067a42c8461f5b8bf13.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p>关闭容器后</p>
<p><img src="https://img-blog.csdnimg.cn/bf55990c64be4a7684b39dabd0c30811.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<h3 id="3-2-4-导出导入容器-x2F-镜像"><a href="#3-2-4-导出导入容器-x2F-镜像" class="headerlink" title="3.2.4 导出导入容器 &#x2F; 镜像"></a>3.2.4 导出导入容器 &#x2F; 镜像</h3><blockquote>
<p>导出容器为tar文件（不会保留历史记录）</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">docker export 容器Id xxx.tar <br></code></pre></td></tr></table></figure>

<blockquote>
<p>导入容器文件为镜像（可重命名）</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">docker import xxx.tar images_name:images_tag<br></code></pre></td></tr></table></figure>

<blockquote>
<p>导出镜像为tar文件（会保留镜像所有历史记录）</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">docker save -o xxx.tar images_name:images_tag<br></code></pre></td></tr></table></figure>

<blockquote>
<p>导入镜像（无法重命名）</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">docker load &lt; xxx.tar <br></code></pre></td></tr></table></figure>

<h3 id="3-2-5-从容器创建新镜像"><a href="#3-2-5-从容器创建新镜像" class="headerlink" title="3.2.5 从容器创建新镜像"></a>3.2.5 从容器创建新镜像</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">docker commit [Option] $id $image_name<br></code></pre></td></tr></table></figure>

<p>Option参数说明</p>
<blockquote>
<p>-a: 提交的镜像作者</p>
<p>-c: 使用Dockerfile指令来创建镜像</p>
<p>-m: 提交时的说明文字</p>
<p>-p: 在commit时，将容器暂停</p>
</blockquote>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/categories/Docker/" class="category-chain-item">Docker</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/tags/Docker/">#Docker</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>Docker _ 基于Ubuntu20.04系统 _ Docker-ce的入门级安装与基本操作</div>
      <div>http://example.com/2021/10/11/Docker _ 基于Ubuntu20.04系统 _ Docker-ce的入门级安装与基本操作/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>John Doe</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2021年10月11日</div>
        </div>
      
      
      <div class="license-meta-item">
        <div>许可协议</div>
        <div>
          
            
            
              <a target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
              <span class="hint--top hint--rounded" aria-label="BY - 署名">
                <i class="iconfont icon-by"></i>
              </span>
              </a>
            
          
        </div>
      </div>
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2021/10/11/Scala%20%E7%AC%94%E8%AE%B01%20%E4%BD%BF%E7%94%A8IDEA%E5%88%9B%E5%BB%BAScala%E8%AF%AD%E8%A8%80%E7%9A%84%E9%A1%B9%E7%9B%AE/" title="Scala 笔记1 使用IDEA创建Scala语言的项目">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">Scala 笔记1 使用IDEA创建Scala语言的项目</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2021/05/24/Linux%20_%20%E5%9F%BA%E4%BA%8EXShell&amp;Xftp%E8%BF%9C%E7%A8%8B%E8%BF%9E%E6%8E%A5%E3%80%81%E6%96%87%E4%BB%B6%E4%BC%A0%E8%BE%93/" title="Linux _ 基于XShell&amp;Xftp远程连接、文件传输">
                        <span class="hidden-mobile">Linux _ 基于XShell&amp;Xftp远程连接、文件传输</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
    </div>
  
  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.18.2/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      headingSelector : CONFIG.toc.headingSelector || 'h1,h2,h3,h4,h5,h6',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      collapseDepth   : CONFIG.toc.collapseDepth || 0,
      scrollSmooth    : true,
      headingsOffset  : -boardTop
    });
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.10/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/js/local-search.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
